package com.yohann.course_service.client;

import com.yohann.utils.result.Result;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import java.util.List;

/**
 * <p>
 * aliyun-service代理
 * </p>
 *
 * @author Yohann
 * @since 2020/10/28 21:45
 */
@Component
@FeignClient("aliyun-service")
public interface AliClient {
    /**
     * 上传照片
     *
     * @param file 照片
     * @return 存储url
     */
    @PostMapping("/aliyun-service/uploadImage")
    Result uploadImage(MultipartFile file);

    /**
     * 上传视频
     *
     * @param file 视频
     * @return 视频id+url
     */
    @PostMapping("/aliyun-service/uploadVideo")
    Result uploadVideo(MultipartFile file);

    /**
     * 删除阿里云中的视频
     *
     * @param id 视频id
     * @return 删除结果
     */
    @DeleteMapping("/aliyun-service/delete/{id}")
    Result deleteVideo(@PathVariable("id") String id);

    /**
     * 批量删除视频
     *
     * @param videoIdList id集合
     * @return 删除结果
     */
    @DeleteMapping("/aliyun-service/delete-batch")
    Result deleteBatch(@RequestParam("videoIdList") List<String> videoIdList);
}